package algorithm;

public class leetcode_0122 {
    public int maxProfit(int[] prices) {
        int profile=0;
        int len=prices.length;
        for(int i=0;i<len-1;++i){
            if(prices[i]<prices[i+1]){
                profile+=prices[i+1]-prices[i];
            }
        }
        return profile;
    }
}
